# -*- coding: utf-8 -*-
import copy
from copy import CopyCmd
from accessFile import  access
from log import  globalLog
from mkfile import  FileCmd
from mkdir import DirCmd

class move():
    def __init__(self):
        pass

    def move(self,src,dst):
        access_ = access(src)
        if access_.isDir():
            self.moveDir(src,dst)
        elif access_.isFile():
            self.moveFile(src,dst)
        else:
            globalLog.Error(src,"is not exsit, can not move to ",dst)
        pass

    def moveFile(self,src,dst):
        CopyCmd.copy(src,dst)
        FileCmd.rmfile(src)
        pass

    def moveDir(self,src,dst):
        CopyCmd.copy(src,dst)
        DirCmd.rmdir(src)
        pass

moveCmd= move()